﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Aspire.App
{
    /// <summary>
    /// 默认主界面
    /// </summary>
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            this.Loaded += MainPage_Loaded;
            this.Unloaded += MainPage_Unloaded;

            AspireFramework.Instance.Frame = this.ContentFrame;
        }

        void MainPage_Unloaded(object sender, RoutedEventArgs e)
        {
        }

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            this.DataContext = AspireFramework.Instance.System;
            // 默认呈现第一个页面。
            //this.ContentFrame.Source = new Uri(AspireFramework.Instance.System.Functions[0].NavigateUri, UriKind.RelativeOrAbsolute);
        }

        // 在 Frame 导航之后，请确保选中表示当前页的 HyperlinkButton
        private void ContentFrame_Navigated(object sender, NavigationEventArgs e)
        {
            //标识系统当前Function
        }

        // 如果导航过程中出现错误，则显示错误窗口
        private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
        {
            e.Handled = true;
        }
    }
}